package Day9;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.HashSet;

import java.util.Map.Entry;

import java.util.Set;

import org.junit.Test;

import Class.Student;

public class list {

	@Test
	public void list0() {
		Student[] student0 = new Student[3];
	    Student student1 = new Student(1, "丁一", 22, null);
		Student student2 = new Student(2, "李二", 22, null);
		Student student3 = new Student(3, "张三", 22, null);
		
		//Student[] students;
//		students[0] = student1;
//		students[1] = student2;
//		students[2] = student3;
		
		ArrayList <Student> list = new ArrayList<Student>();
		list.add(student1);
		list.add(student2);
		list.add(student3);	
		list.add(student3);	
		for(Student student : list) {
			System.out.println(student);
		}
		
		System.out.println("---------");
		HashSet <Student> set = new HashSet<Student>();
		set.add(student1);
		set.add(student2);
		set.add(student3);
		set.add(student3);
		for(Student student : set) {
			System.out.println(student);
		}
		
		System.out.println("--------------------");
		HashMap <String, String> map = new HashMap<String, String>();
		map.put("CN","中国");
		map.put("US","美国");
		String value1 = map.get("CN");
		System.out.println(value1);
		
		Set<Entry<String, String>> set1 = map.entrySet();
		for(Entry<String, String> entry : set1) {
			String key = entry.getKey();
			String value = entry.getValue();
			System.out.println("key:" + key + "value" + value);
		}
		
		System.out.println("---------------------");
		Set<String> set2 = map.keySet();
		for(String key : set2) {
			String value = map.get(key);
			System.out.println("key:" + key + "value:" + value);
		}
		
		
	}
	
	@Test
	public void test22() {
		ArrayList<Integer> list = new ArrayList<Integer>();
		list.add(2);
		list.add(22);
		for(Integer integer : list) {
			System.out.println(integer);
		}
		
		System.out.println(Integer.MAX_VALUE);
		System.out.println(Integer.MIN_VALUE);
		
		Integer integer = 4;
		int i = integer.intValue();
		int num = 4;
		num += 2;
		integer = integer + 2;
		System.out.println(integer);
	}
	
	@Test
	public void list1() {
		ArrayList <Student> list = new ArrayList <Student>();
		Student student1 = new Student(1,"张三",22,null);
		Student student2 = new Student(2,"张三2",22,null);
		Student student3 = new Student(3,"张三3",22,null);
		Student student4 = new Student(4,"张三4",22,null);
		
		String str = "333";
		int value = Integer.parseInt(str);
		System.out.println(value);
		
		String str2 = "3.22";
		double value2 = Double.parseDouble(str2);
		System.out.println(value2);
		
		String str3 = "true";
		boolean value3 = Boolean.parseBoolean(str3);
		System.out.println(value3);
	}
	public static void main(String[] args) {
		
	}

}
